﻿@{
    ViewData["Title"] = "首页报表统计";
}
@section css{
<link href="~/css/report.css" rel="stylesheet" />
}
<div class="layuimini-container">
    <div class="layuimini-main">
        <div class="layui-row layui-col-space15">
           <div class="layui-card-header"><i class="fa fa-warning icon"></i>数据统计</div>
           <div class="layui-card-body">
                    <div class="layui-row layui-col-space10">
                        <div class="layui-col-xs6" style="width:20%">
                            <div class="panel layui-bg-number">
                                <div class="panel-body">
                                    <div class="panel-title">
                                        <span class="label pull-right layui-bg-blue">文章统计</span>
                                    </div>
                                    <div class="panel-content">
                                        <h1 class="no-margins">@ViewBag.articleCount</h1>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="layui-col-xs6" style="width:20%">
                            <div class="panel layui-bg-number">
                                <div class="panel-body">
                                    <div class="panel-title">
                                        <span class="label pull-right layui-bg-cyan">文章栏目统计</span>
                                    </div>
                                    <div class="panel-content">
                                        <h1 class="no-margins">@ViewBag.columnCount</h1>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="layui-col-xs6" style="width:20%">
                            <div class="panel layui-bg-number">
                                <div class="panel-body">
                                    <div class="panel-title">
                                        <span class="label pull-right layui-bg-orange">商品统计</span>
                                    </div>
                                    <div class="panel-content">
                                        <h1 class="no-margins">@ViewBag.goodsCount</h1>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="layui-col-xs6" style="width:20%">
                            <div class="panel layui-bg-number">
                                <div class="panel-body">
                                    <div class="panel-title">
                                        <span class="label pull-right layui-bg-orange">商品栏目统计</span>
                                    </div>
                                    <div class="panel-content">
                                        <h1 class="no-margins">@ViewBag.categoryCount</h1>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="layui-col-xs6" style="width:20%">
                            <div class="panel layui-bg-number">
                                <div class="panel-body">
                                    <div class="panel-title">
                                        <span class="label pull-right layui-bg-green">订单统计</span>
                                    </div>
                                    <div class="panel-content">
                                        <h1 class="no-margins">@ViewBag.orderCount</h1>                                       
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
           </div>
            <div class="layui-col-md12">
                <div class="layui-card">
                    <div class="layui-card-header"><i class="fa fa-line-chart icon"></i>报表统计</div>
                    <div class="layui-card-body">
                        <div id="echarts-records" style="width: 100%;min-height:500px"></div>
                    </div>
                </div>                                
            </div>
            <div class="layui-col-md12">
                 <div class="layui-card">
                    <div class="layui-card-header"><i class="fa fa-bullhorn icon icon-tip"></i>系统公告</div>
                    <div class="layui-card-body layui-text">
                        <div class="layuimini-notice">
                            <div class="layuimini-notice-title">修改选项卡样式1修改选项卡样式1修改选项卡样式1</div>
                            <div class="layuimini-notice-extra">2019-07-11 23:06</div>
                            <div class="layuimini-notice-content layui-hide">
                                界面足够简洁清爽。<br>
                                一个接口几行代码而已直接初始化整个框架，无需复杂操作。<br>
                            </div>
                        </div>
                    </div>
                    <div class="layui-card-body layui-text">
                        <div class="layuimini-notice">
                            <div class="layuimini-notice-title">修改选项卡样式2修改选项卡样式1修改选项卡样式1</div>
                            <div class="layuimini-notice-extra">2019-07-11 23:06</div>
                            <div class="layuimini-notice-content layui-hide">
                                界面足够简洁清爽。<br>
                                一个接口几行代码而已直接初始化整个框架，无需复杂操作。<br>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

@section js{
<script>
    layui.use(['layer', 'miniTab','echarts'], function () {
            var $ = layui.jquery,
                layer = layui.layer,
                miniTab = layui.miniTab,
                echarts = layui.echarts;

            miniTab.listen();

            /**
             * 查看公告信息
             **/
            $('body').on('click', '.layuimini-notice', function () {
                var title = $(this).children('.layuimini-notice-title').text(),
                    noticeTime = $(this).children('.layuimini-notice-extra').text(),
                    content = $(this).children('.layuimini-notice-content').html();
                var html = '<div style="padding:15px 20px; text-align:justify; line-height: 22px;border-bottom:1px solid #e2e2e2;background-color: #2f4056;color: #ffffff">\n' +
                    '<div style="text-align: center;margin-bottom: 20px;font-weight: bold;border-bottom:1px solid #718fb5;padding-bottom: 5px"><h4 class="text-danger">' + title + '</h4></div>\n' +
                    '<div style="font-size: 12px">' + content + '</div>\n' +
                    '</div>\n';
                parent.layer.open({
                    type: 1,
                    title: '系统公告'+'<span style="float: right;right: 1px;font-size: 12px;color: #b1b3b9;margin-top: 1px">'+noticeTime+'</span>',
                    area: '300px;',
                    shade: 0.8,
                    id: 'layuimini-notice',
                    btnAlign: 'c',
                    moveType: 1,
                    content:html,
                    success: function (layero) {

                    }
                });
            });

            /**
             * 报表功能
             */
            var echartsRecords = echarts.init(document.getElementById('echarts-records'), 'walden');
            var optionRecords = {
                tooltip: {
                    trigger: 'axis'
                },
                legend: {
                    data:['邮件营销','联盟广告','视频广告','直接访问','搜索引擎']
                },
                grid: {
                    left: '3%',
                    right: '4%',
                    bottom: '3%',
                    containLabel: true
                },
                toolbox: {
                    feature: {
                        saveAsImage: {}
                    }
                },
                xAxis: {
                    type: 'category',
                    boundaryGap: false,
                    data: ['周一','周二','周三','周四','周五','周六','周日']
                },
                yAxis: {
                    type: 'value'
                },
                series: [
                    {
                        name:'邮件营销',
                        type:'line',
                        data:[120, 132, 101, 134, 90, 230, 210]
                    },
                    {
                        name:'联盟广告',
                        type:'line',
                        data:[220, 182, 191, 234, 290, 330, 310]
                    },
                    {
                        name:'视频广告',
                        type:'line',
                        data:[150, 232, 201, 154, 190, 330, 410]
                    },
                    {
                        name:'直接访问',
                        type:'line',
                        data:[320, 332, 301, 334, 390, 330, 320]
                    },
                    {
                        name:'搜索引擎',
                        type:'line',
                        data:[820, 932, 901, 934, 1290, 1330, 1320]
                    }
                ]
            };
            echartsRecords.setOption(optionRecords);

            // echarts 窗口缩放自适应
            window.onresize = function(){
                echartsRecords.resize();
            }

        });
</script>
}
